#ifndef __BUOLA_SCENE_CRENDERER_H__
#define __BUOLA_SCENE_CRENDERER_H__

#include <buola/gl.h>
#include <buola/gl/cprogram.h>

#include <buola/scene.h>
#include <buola/scene/cscene.h>
#include <buola/scene/ccamera.h>

namespace buola { namespace scene {

class CRenderer
{
protected:
    enum EFlags {
        FLAG_NONE=0,
        FLAG_FLIP=(1<<0)
    };

    DECLARE_FRIEND_ENUM_BITOPS(EFlags)
    
public:
    CRenderer(EFlags pFlags=FLAG_NONE);
    virtual ~CRenderer();

    void SetCamera(PCamera pCam);
    void AddScene(PScene pScene);

    void SetClearColor(const img::CColor &pColor);
    const img::CColor &GetClearColor()   {   return mClearColor; }
    
    PCamera GetCamera() {   return mCamera; }
    
protected:
    void Render();
    void RenderWithTransformIndex(std::vector<PTransform> &pTransforms);

private:
    void DoRender(std::vector<PTransform> &pTransforms,bool pTransformIndex);
    
private:
    EFlags mFlags;
    
    PCamera mCamera;
    std::vector<PScene> mScenes;
    img::CColor mClearColor;
};

/*namespace scene*/ } /*namespace buola*/ }

#endif
